package com.nbsaas.boot.common.rest.resource;

import com.nbsaas.boot.common.api.apis.ModularApi;
import com.nbsaas.boot.common.data.entity.Modular;
import com.nbsaas.boot.common.api.domain.request.ModularRequest;
import com.nbsaas.boot.common.api.domain.response.ModularResponse;
import com.nbsaas.boot.common.api.domain.simple.ModularSimple;
import com.nbsaas.boot.common.rest.convert.ModularSimpleConvert;
import com.nbsaas.boot.common.rest.convert.ModularEntityConvert;
import com.nbsaas.boot.common.rest.convert.ModularResponseConvert;
import com.nbsaas.boot.common.data.repository.ModularRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   模块-业务接口实现
*/
@Transactional
@Service
public class ModularResource extends BaseResource<Modular,ModularResponse, ModularSimple, ModularRequest>  implements ModularApi {

    @Resource
    private ModularRepository modularRepository;

    @Override
    public JpaRepositoryImplementation<Modular, Serializable> getJpaRepository() {
        return modularRepository;
    }

    @Override
    public Function<Modular, ModularSimple> getConvertSimple() {
        return new ModularSimpleConvert();
    }

    @Override
    public Function<ModularRequest, Modular> getConvertForm() {
        return new ModularEntityConvert();
    }

    @Override
    public Function<Modular, ModularResponse> getConvertResponse() {
        return new ModularResponseConvert();
    }




}


